<template>
  <div>
    <Item :list="list"></Item>
  </div>
</template>

<script>
import Item from "@/views/Item";
import { mapState, mapMutations, mapActions } from "vuex";

export default {
  data() {
    return {};
  },
  computed: {
    ...mapState(['types']),
    list: {
      get: function() {
        return this.$store.state.list;
      },
      set: function(newValue) {
        this.$store.state.list = newValue;
      }
    }
  },
  components: {
    Item
  },
  mounted: function() {
    console.log(this.$store.state.list);
    console.log(mapState);
    this.getItem();
  },
  methods: {
    getItem() {
      this.$http.post("/api/getList",{types:this.types}).then(({ data }) => {
        this.list = data.list;
        console.log(data.list);
      });
    }
  }
};
</script>
<style lang="scss">
</style>